package com.jinxin.platform.cdsmsmgr.controller;

import com.jinxin.platform.base.api.annotation.APCOSApi;
import com.jinxin.platform.base.api.annotation.APCOSApiOperation;
import com.jinxin.platform.base.api.constant.APCOSApiConstans;
import com.jinxin.platform.cdsmsmgr.rpc.SmsRpcService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.Map;

/**
 * All rights Reserved, Designed By www.beonelot.com
 *
 * @version: V1.0
 * @Copyright: www.beonelot.com Inc. All rights reserved.
 * @Description：
 * @Date:
 * @Author: Lingnan
 **/
@APCOSApi(value = "测试接口", developers = {"那个男人"}, description = "测试接口")
@RestController
@RequestMapping("/cdsmsmgr/test")
@Slf4j
public class TestController {
    @Autowired
    private SmsRpcService smsRpcService;

    @APCOSApiOperation(value = "testRpc", developers = {"lingnan"}, description = "testRpc",
            infType = APCOSApiConstans.INF_TYPE_OTHER, infCategory = APCOSApiConstans.INF_CATEGORY_WEB)
    @GetMapping("/testRpc")
    public Object test(String businessModule, String smsType,String receiveUser,String receivePhone){
        Map param = new HashMap<>();
        param.put("businessModule",businessModule);
        param.put("smsType",smsType);
        param.put("receiveUser",receiveUser);
        param.put("receivePhone",receivePhone);
        param.put("params","测试车场,2023年12月31日14:54:30");
        return smsRpcService.sendSms(param);
    }

    //http://localhost:8084/cdsmsmgr/test/testRpcBatch?businessModule=%E6%B5%8B%E8%AF%95&smsType=1&receiveUsers=%E4%BA%8C%E7%8B%97%E5%AD%90,%E7%8E%8B%E9%BA%BB%E5%AD%90&receivePhones=15928085495,19302849238
    @APCOSApiOperation(value = "testRpcBatch", developers = {"lingnan"}, description = "testRpc",
            infType = APCOSApiConstans.INF_TYPE_OTHER, infCategory = APCOSApiConstans.INF_CATEGORY_WEB)
    @GetMapping("/testRpcBatch")
    public Object testRpcBatch(String businessModule, String smsType,String receiveUsers,String receivePhones){
        Map param = new HashMap<>();
        param.put("businessModule",businessModule);
        param.put("smsType",smsType);
        param.put("receiveUsers",receiveUsers);
        param.put("receivePhones",receivePhones);
        param.put("params","123456");
        return smsRpcService.sendBatchSms(param);
    }

}
